import { ImageResponse } from 'next/og'; import { Fallback, Wallpaper } from '@/components/brand/og'; import { fmtMemory } from '@/components/hardware/hardware-bits'; import { api, intel, safe } from '@/lib/api'; import { fmtInt, num } from '@/lib/format'; import { SITE_NAME } from '@/lib/site'; export const runtime = 'nodejs'; export const alt = `Hardware on ${SITE_NAME}`; export const size = { width: 1200, height: 630 }; export const contentType = 'image/png'; export default async function HardwareOgImage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const [d, fit] = await Promise.all([safe(api.entityOfType('hardware', slug)), safe(intel.hardwareSlugFit(slug, { limit: 1 }))]); if (!d || d.entity_type !== 'hardware') return new ImageResponse(, { ...size }); const a = d.attributes ?? {}; const counters: [string, string][] = [['Memory', fmtMemory(a.memory_gb)]]; if (num(a.memory_bandwidth_gbs) !== null) counters.push(['Bandwidth', `${fmtInt(a.memory_bandwidth_gbs)} GB/s`]); if (num(a.tdp_watts) !== null) counters.push(['TDP', `${fmtInt(a.tdp_watts)} W`]); if (fit) counters.push(['Fit @4bit (est.)', `${fmtInt(fit.counts.fits)} / ${fmtInt(fit.counts.evaluated)}`]); return new ImageResponse(, { ...size }); }